package com.kyzh.core.adapters

import com.bumptech.glide.Glide
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.gushenge.atools.ui.ArcButton
import com.gushenge.core.beans.Server
import com.kyzh.core.R
import com.kyzh.core.utils.startGameDetailActivity


class ServerListAdapter(layout:Int,beans:MutableList<Server>):BaseQuickAdapter<Server,BaseViewHolder>(layout,beans) {
    override fun convert(helper: BaseViewHolder, item: Server) {
        item?.let {
            helper.setText(R.id.name,it.name)
                    .setText(R.id.type,it.server_name)
                    .setText(R.id.type2,it.time1)
                    .setText(R.id.time,it.time2)
                    .setText(R.id.state,context.getString(R.string.detail))
                    helper.getView<ArcButton>(R.id.state).setOnClickListener { i->context.startGameDetailActivity(it.game_id)}
            Glide.with(context).load(it.icon).into(helper.getView(R.id.image))

        }
    }
}